package com.googlecode.gwtbb.client.shared.remote;

import com.googlecode.gwtbb.client.shared.validation.Failure;
import com.googlecode.gwtbb.client.shared.validation.FieldId;

import java.io.Serializable;
import java.util.Map;

/**
 * @author Abraham Grief
 * @version $Id$
 * @since Apr 17, 2008
 */
public class ClientResponse implements Serializable {
	// used in special cases like file upload responses
	public static final String TEXT_DELIM = "::";
	public static final String OK = "ok";
	public static final String SERVER_ERROR = "serverError";
	public static final String ERROR = "error";
	public static final String FILE_KEY = "fileKey";
	public static final String FILE_UPLOAD = "fileUpload";

	protected Map<FieldId, Failure> failures;

	public Map<FieldId, Failure> getFailures() {
		return failures;
	}

	public void setFailures(Map<FieldId, Failure> failures) {
		this.failures = failures;
	}

	public boolean isSuccessful() {
		return failures == null || failures.isEmpty();
	}
}
